home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Screenblankers / GBlanker / GSource / libraries.c < prev    next >
C/C++ Source or Header  |  1996-09-26  |  1KB  |  60 lines

  1. /*
  2.  *  Copyright (c) 1994 Michael D. Bayne.
  3.  *  All rights reserved.
  4.  *
  5.  *  Please see the documentation accompanying the distribution for distribution
  6.  *  and disclaimer information.
  7.  */
  8.  
  9. #include <string.h>
  10.  
  11. #include "includes.h"
  12. #include "libraries.h"
  13.  
  14. #define NUM_LIBS 7
  15.  
  16. extern struct Library *SysBase;
  17. struct Library *Libraries[NUM_LIBS];
  18.  
  19. STRPTR LibNames[] = {
  20.     "dos.library", "intuition.library", "graphics.library", "icon.library",
  21.     "commodities.library", "Garshnelib.library", "utility.library"
  22.     };
  23. LONG LibVersions[] = { 37, 37, 37, 37, 37, 37, 37 };
  24.  
  25. LONG OpenLibraries( VOID )
  26. {
  27.     LONG i, RetVal = 0L;
  28.  
  29.     for( i = 0; i < NUM_LIBS; i++ )
  30.     {
  31.         Libraries[i] = OpenLibrary( LibNames[i], LibVersions[i] );
  32.         if( !Libraries[i] )
  33.         {
  34.             if( IntuitionBase )
  35.             {
  36.                 struct EasyStruct ErrorReq = {
  37.                     sizeof( struct EasyStruct ), 0, "Information", 0L, "Ok" };
  38.                 BYTE ErrorStr[64];
  39.  
  40.                 strcpy( ErrorStr, LibNames[i] );
  41.                 strcat( ErrorStr, " failed to open." );
  42.                 ErrorReq.es_TextFormat = ErrorStr;
  43.                 EasyRequestArgs( 0L, &ErrorReq, 0L, 0L );
  44.             }
  45.             RetVal = 1L;
  46.         }
  47.     }
  48.  
  49.     return RetVal;
  50. }
  51.  
  52. VOID CloseLibraries( VOID )
  53. {
  54.     LONG i;
  55.  
  56.     for( i = 0; i < NUM_LIBS; i++ )
  57.         if( Libraries[i] )
  58.             CloseLibrary( Libraries[i] );
  59. }
  60.